package cn.rtangyy.seckilling.utils;

import org.apache.commons.lang3.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValidatorUtil {

    private static String mobileRex = "^(1)\\d{10}$";
    private static final Pattern mobilePattern = Pattern.compile(mobileRex);

    private ValidatorUtil() {}

    /**
     * 手机号码校验
     * @param src
     * @return
     */
    public static boolean isMobile(String src) {
        if (StringUtils.isEmpty(src)) {
            return false;
        }
        Matcher matcher = mobilePattern.matcher(src);
        return matcher.matches();

    }
}
